package com.xjm.ips.service;

import com.xjm.ips.entity.RewardOrPenalty;
import com.xjm.ips.mapper.RewardOrPenaltyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class RewardOrPenaltyService {
    @Autowired
    RewardOrPenaltyMapper rewardOrPenaltyMapper;

    public List<RewardOrPenalty> getRewardsOrPenalties() {
        return rewardOrPenaltyMapper.getRewardsOrPenalties();
    }

    public Integer updateRewardOrPenalty(RewardOrPenalty rewardOrPenalty) {
        return rewardOrPenaltyMapper.updateByPrimaryKeySelective(rewardOrPenalty);
    }

    public Integer addRewardOrPenalty(RewardOrPenalty rewardOrPenalty) {
        rewardOrPenalty.setCreateTime(new Date());
        return rewardOrPenaltyMapper.insertSelective(rewardOrPenalty);
    }

    public Integer deleteRewardOrPenaltyById(Integer id) {
        return rewardOrPenaltyMapper.deleteByPrimaryKey(id);
    }
}
